package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.ShopClassifyBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;


/**
 * Created by Administrator on 2018/1/17.
 */

public class ShopTypeAdapter extends SuperBaseAdapter<ShopClassifyBean.DataBean> {

    public ShopTypeAdapter(Context context, List<ShopClassifyBean.DataBean> data) {
        super(context, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, ShopClassifyBean.DataBean item, int position) {
        ImageView iv = holder.getView(R.id.iv_logo);
        switch (item.getShopButtonName()) {
            case "服装城":
                iv.setImageResource(R.mipmap.fuzhuangcheng);
                break;
            case "食品":
                iv.setImageResource(R.mipmap.food);
                break;
            case "日常用品":
                iv.setImageResource(R.mipmap.richangyongpin);
                break;
            case "家用电器":
                iv.setImageResource(R.mipmap.jiayongdianqi);
                break;
            case "日化洗护":
                iv.setImageResource(R.mipmap.rihuaxihu);
                break;
            case "母婴玩具":
                iv.setImageResource(R.mipmap.muyinwanju);
                break;
            case "电子数码":
                iv.setImageResource(R.mipmap.dianzishuma);
                break;
            case "更多":
                iv.setImageResource(R.mipmap.gengduo);
                break;
        }
        holder.setText(R.id.tv_title, item.getShopButtonName());
        holder.setOnClickListener(R.id.iv_logo, new OnItemChildClickListener());
    }

    @Override
    protected int getItemViewLayoutId(int position, ShopClassifyBean.DataBean item) {
        return R.layout.adapter_shape_type;
    }

}
